<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <ul class="citylist">
        <li>北京1</li>
        <li>北京2</li>
        <li>北京3</li>
        <li>北京4</li>
        <li>北京5</li>
    </ul>
    <script>
        var lis = document.querySelectorAll('.citylist li')
        lis.forEach(function (element, index) {
            console.log(fn)
            element.onclick = fn
            // console.log(element.onclick )
        })
        
        var fn = function () {
            // this指代调用fn事件源。
            console.log(this)
            console.log(this.innerHTML)
        }



    </script>
</body>

</html>